package com.fly.Test;

import com.fly.pojo.UtcsDept;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;

/**
 * Created by SWan on 2017/1/9.
 */
public class UtcsDeptTest {

    public static void main(String[] args) throws IOException {
      //  String resource = "com/fly/config/mybatis-config.xml";
        String resource = "fly/mybatis-config.xml";
        InputStream inputStream = Resources.getResourceAsStream(resource);
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
        SqlSession sqlSession = sqlSessionFactory.openSession();
        try {
            UtcsDept utcsDept = (UtcsDept) sqlSession.selectOne("UtcsDept.selectDept", 10);
        } finally {
            sqlSession.close();
        }
    }
}
